package com.wanmait.teatrain.controller;

import com.wanmait.teatrain.entity.TrainingTag;
import com.wanmait.teatrain.service.TrainingTagService;
import com.wanmait.teatrain.utils.AjaxResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 培训内容标签表 前端控制器
 * </p>
 *
 * @author wanmait
 * @since 2025-10-22
 */
@RestController
@RequestMapping("/trainingTag")
public class TrainingTagController {
    @Resource
    private TrainingTagService trainingTagService;

    //添加资源时获得标签列表，只有tagId和tagName，并且为级联选择器的数据形式
    //如有需要，请重新编写代码 --徐钰淞
    @RequestMapping("getTag")
    public AjaxResult getTag() {
        return trainingTagService.getTag();
    }

    @GetMapping("list")
    public AjaxResult list() {
        List<TrainingTag> trainingTags = trainingTagService.list();
        return AjaxResult.success().put("trainingTags", trainingTags);
    }
}
